﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/admin/admin.Master" CodeBehind="Products.aspx.vb" Inherits="UI.Products" %>

<%@ Import Namespace="Telerik.Web.UI" %>
<%@ Import Namespace="Telerik.Web.UI.Skins" %>
<%@ Import Namespace="KOR.Helpers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <style type="text/css">
        .divRow {
            float: left;
            /*width: 50%;*/
        }

        .control-group {
            float: left;
            padding-right: 40px;
        }
    </style>


    <div class="row">
        <div class="span12">
            <div class="widget ">
                <div class="widget-header">
                    <i class="icon-user"></i>
                    <h3>Products</h3>
                    <asp:HiddenField runat="server" ID="hfProductID" Value="0" />
                </div>
                <!-- /widget-header -->
                <div class="widget-content">
                    <div class="tabbable">
                        <ul class="nav nav-tabs">
                            <li class="active">
                                <a href="#formcontrols" data-toggle="tab">Entry Form</a>
                            </li>
                            <li><a href="#jscontrols" data-toggle="tab">Product List</a></li>
                        </ul>

                        <br />

                        <div class="tab-content ">
                            <div class="tab-pane  active" id="formcontrols">
                                <fieldset>
                                    <div class="divRow">
                                        <div class="control-group">
                                            <label class="control-label" for="username">Product Name</label>
                                            <div class="controls">
                                                <asp:TextBox runat="server" ID="txtProductName"></asp:TextBox>
                                            </div>
                                            <!-- /controls -->
                                        </div>

                                        <div class="control-group">
                                            <label class="control-label" for="username">SKU</label>
                                            <div class="controls">
                                                <asp:TextBox runat="server" ID="txtSKU"></asp:TextBox>
                                            </div>
                                            <!-- /controls -->
                                        </div>
                                    </div>

                                    <div style="clear: both;"></div>

                                    <div class="divRow">

                                        <div class="control-group">
                                            <label class="control-label" for="username">Brand</label>
                                            <div class="controls">
                                                <asp:DropDownList runat="server" ID="ddlBrands" DataTextField="BrandName" DataValueField="BrandID" DataSourceID="odsBrands"></asp:DropDownList>
                                                <asp:ObjectDataSource ID="odsBrands" runat="server" TypeName="UI.BL.Brands"
                                                    SelectMethod="GetAllBrands"></asp:ObjectDataSource>
                                            </div>
                                            <!-- /controls -->
                                        </div>

                                        <div class="control-group">
                                            <label class="control-label" for="username">Category</label>
                                            <div class="controls">
                                                <asp:DropDownList runat="server" ID="ddlCategory" DataTextField="CategoryName" DataValueField="CategoryID" DataSourceID="odsCategories"></asp:DropDownList>
                                                <asp:ObjectDataSource ID="odsCategories" runat="server" TypeName="UI.BL.Categories"
                                                    SelectMethod="GetAllCategories"></asp:ObjectDataSource>

                                            </div>
                                            <!-- /controls -->
                                        </div>

                                    </div>
                                    <div style="clear: both;"></div>
                                    <div class="divRow">

                                        <div class="control-group">
                                            <label class="control-label" for="username">Price Range ($)</label>
                                            <div class="controls">
                                                <asp:DropDownList runat="server" ID="ddlPrice" DataTextField="PriceRange" DataValueField="PriceRangeID" DataSourceID="odsPriceRange"></asp:DropDownList>
                                                <asp:ObjectDataSource ID="odsPriceRange" runat="server" TypeName="UI.BL.PriceRanges"
                                                    SelectMethod="GetAllPriceRanges"></asp:ObjectDataSource>
                                            </div>
                                            <!-- /controls -->
                                        </div>

                                        <div class="control-group">
                                            <label class="control-label" for="username">Price ($)</label>
                                            <div class="controls">
                                                <asp:TextBox runat="server" ID="txtPrice"></asp:TextBox>
                                            </div>
                                            <!-- /controls -->
                                        </div>



                                    </div>
                                    <div style="clear: both;"></div>
                                    <div class="divRow">

                                        <div class="control-group">
                                            <label class="control-label" for="username">Label Size</label>
                                            <div class="controls">
                                                <asp:DropDownList runat="server" ID="ddlLabelSize" DataTextField="LabelSize" DataValueField="LabelSizeID" DataSourceID="odsLabelSize"></asp:DropDownList>
                                                <asp:ObjectDataSource ID="odsLabelSize" runat="server" TypeName="UI.BL.LabelSizes"
                                                    SelectMethod="GetAllLabelSizes"></asp:ObjectDataSource>

                                            </div>
                                            <!-- /controls -->
                                        </div>

                                        <div class="control-group">
                                            <label class="control-label" for="username">Core Diameter</label>
                                            <div class="controls">
                                                <asp:DropDownList runat="server" ID="ddlCoreDiameter" DataTextField="CoreDiameter" DataValueField="CoreDiameterID" DataSourceID="odsCoreDiameters" AppendDataBoundItems="true">
                                                    <asp:ListItem Text="Does not apply" Value="0"></asp:ListItem>
                                                </asp:DropDownList>
                                                <asp:ObjectDataSource ID="odsCoreDiameters" runat="server" TypeName="UI.BL.CoreDiameters"
                                                    SelectMethod="GetAllCoreDiameters"></asp:ObjectDataSource>

                                            </div>
                                            <!-- /controls -->
                                        </div>



                                    </div>
                                    <div style="clear: both;"></div>
                                    <div class="divRow">
                                        <div class="control-group">
                                            <label class="control-label" for="username">Plastic Holder Include</label>
                                            <div class="controls">
                                                <asp:CheckBox runat="server" ID="chkPlasticHolder" />
                                            </div>
                                            <!-- /controls -->
                                        </div>
                                    </div>
                                    <div style="clear: both;"></div>
                                    <div class="divRow">

                                        <div class="control-group">
                                            <label class="control-label" for="username">Print Color</label>
                                            <div class="controls">
                                                <asp:DropDownList runat="server" ID="ddlColor" DataTextField="Color" DataValueField="ColorID" DataSourceID="odsColors"></asp:DropDownList>
                                                <asp:ObjectDataSource ID="odsColors" runat="server" TypeName="UI.BL.Colors"
                                                    SelectMethod="GetAllColors"></asp:ObjectDataSource>

                                            </div>
                                            <!-- /controls -->
                                        </div>

                                        <div class="control-group">
                                            <label class="control-label" for="username">Tape/Label Background Color</label>
                                            <div class="controls">
                                                <asp:DropDownList runat="server" ID="ddlColorTape" DataTextField="Color" DataValueField="ColorID" DataSourceID="odsColors"></asp:DropDownList>
                                                <%--<asp:ObjectDataSource ID="odsTapeColor" runat="server" TypeName="Web.UI.BL.TapeColors" SelectMethod="GetAllTapeColors"></asp:ObjectDataSource>--%>
                                            </div>
                                            <!-- /controls -->
                                        </div>

                                    </div>
                                    <div style="clear: both;"></div>
                                    <div class="divRow">

                                        <div class="control-group">
                                            <label class="control-label" for="username">Tape Width</label>
                                            <div class="controls">
                                                <asp:DropDownList runat="server" ID="ddlTextWidth" DataTextField="TapeWidth" DataValueField="TapeWidthID" DataSourceID="odsTapeWidth"></asp:DropDownList>
                                                <asp:ObjectDataSource ID="odsTapeWidth" runat="server" TypeName="UI.BL.TapeWidths"
                                                    SelectMethod="GetAllTapeWidths"></asp:ObjectDataSource>

                                            </div>
                                            <!-- /controls -->
                                        </div>

                                        <div class="control-group">
                                            <label class="control-label" for="username">Tape Length</label>
                                            <div class="controls">
                                                <asp:DropDownList runat="server" ID="ddlTapeLength" DataTextField="TapeLength" DataValueField="TapeLengthID" DataSourceID="odsTapeLength"></asp:DropDownList>
                                                <asp:ObjectDataSource ID="odsTapeLength" runat="server" TypeName="UI.BL.TapeLengths"
                                                    SelectMethod="GetAllTapeLengths"></asp:ObjectDataSource>
                                            </div>
                                            <!-- /controls -->
                                        </div>

                                    </div>
                                    <div style="clear: both;"></div>

                                    <div class="divRow">
                                        <div class="control-group">
                                            <label class="control-label" for="username">No. of Labels per Roll</label>
                                            <div class="controls">
                                                <asp:TextBox runat="server" ID="txtNoOfLabels" Text="250"></asp:TextBox>
                                            </div>
                                        </div>
                                        <div class="control-group">
                                            <label class="control-label" for="username">Re-Order Level</label>
                                            <div class="controls">
                                                <asp:TextBox runat="server" ID="txtReOrderLevel"></asp:TextBox>
                                            </div>
                                            <!-- /controls -->
                                        </div>
                                    </div>

                                    <div style="clear: both;"></div>

                                    <div class="divRow">

                                        <div class="control-group">
                                            <label class="control-label" for="username">Description</label>
                                            <div class="controls">
                                                <telerik:RadEditor runat="server" ID="reDesc" ToolsFile="~/App_Data/RadEditor/SmallToolbar.xml"
                                                    StripFormattingOnPaste="AllExceptNewLines" EditModes="Design" Height="300px">
                                                </telerik:RadEditor>
                                            </div>
                                            <!-- /controls -->
                                        </div>
                                    </div>

                                    <div class="divRow">
                                        <div class="control-group">
                                            <label class="control-label" for="username">Printer Support</label>
                                            <div class="controls">
                                                <telerik:RadEditor runat="server" ID="radPrinterSupport" ToolsFile="~/App_Data/RadEditor/SmallToolbar.xml"
                                                    StripFormattingOnPaste="AllExceptNewLines" EditModes="Design" Height="300px">
                                                </telerik:RadEditor>
                                            </div>
                                            <!-- /controls -->
                                        </div>
                                    </div>

                                    <div class="divRow">
                                        <div class="control-group">
                                            <label class="control-label" for="username">Non Competible Printers</label>
                                            <div class="controls">
                                                <telerik:RadEditor runat="server" ID="reNonCompetible" ToolsFile="~/App_Data/RadEditor/SmallToolbar.xml"
                                                    StripFormattingOnPaste="AllExceptNewLines" EditModes="Design" Height="300px">
                                                </telerik:RadEditor>
                                            </div>
                                            <!-- /controls -->
                                        </div>
                                    </div>

                                    <div style="clear: both;"></div>

                                    <div class="divRow">
                                        <label class="control-label" for="username">Upload Pictures</label>
                                        <div class="controls">
                                            <telerik:RadAsyncUpload runat="server" ID="radUpload" Width="330px" Height="20px"
                                                AllowedFileExtensions=".jpg,.png,.gif,.jpeg" MaxFileInputsCount="5"></telerik:RadAsyncUpload>
                                        </div>
                                    </div>

                                    <div class="divRow">
                                        <label class="control-label" for="username"></label>
                                        <div class="controls">
                                            <asp:DataList runat="server" ID="dlstPictures" RepeatDirection="Horizontal">
                                                <ItemTemplate>
                                                    <div>
                                                        <div style="float:left;max-height:100px; max-width:100px;">
                                                            <telerik:RadBinaryImage runat="server" ID="rbiImage" Style="width: 100px; height: 100px;" />
                                                        </div>
                                                        <div style="float:left;max-height:20px; max-width:20px;">
                                                            <asp:imagebutton runat="server" ID="imgDelete" ImageUrl="~/admin/img/cancel.png"  
                                                                Style="width: 20px; height: 20px;" CommandName="Delete" 
                                                                CommandArgument='<%# ValueOrDefault(Eval("FileID"), 0).ToString()%>'  OnClientClick="return confirm('Are you sure you want to remove picture?');" />
                                                        </div>
                                                    </div>
                                                </ItemTemplate>
                                            </asp:DataList>
                                        </div>
                                    </div>

                                    <!-- /control-group -->

                                    <asp:HiddenField runat="server" ID="hfFileIds" />

                                    <div style="clear: both;"></div>
                                    <br />
                                    <div class="form-actions" style="position:relative;">
                                        <asp:Button runat="server" ID="btnSave" CssClass="btn btn-primary" Text="Save" />
                                        <asp:Button runat="server" ID="btnCancel" CssClass="btn" Text="Cancel" />
                                    </div>
                                    <!-- /form-actions -->
                                </fieldset>
                            </div>

                            <div class="tab-pane" id="jscontrols">
                                <fieldset>
                                    <br />
                                    <telerik:RadGrid runat="server" ID="rgProducts" ViewStateMode="Disabled" DataSourceID="odsProducts" Width="100%"
                                        EnableEmbeddedSkins="false" MasterTableView-EditMode="InPlace"
                                        AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False">
                                        <MasterTableView runat="server" PageSize="50" ClientDataKeyNames="ProductID" DataSourceID="odsProducts"
                                            DataKeyNames="ProductID" AllowMultiColumnSorting="true">
                                            <HeaderStyle BorderStyle="None" HorizontalAlign="Center" Font-Bold="true" Font-Underline="true" />
                                            <ItemStyle BorderStyle="None" HorizontalAlign="Center" />
                                            <AlternatingItemStyle BorderStyle="None" HorizontalAlign="Center" />
                                            <EditItemStyle BorderStyle="None" HorizontalAlign="Right" />
                                            <Columns>

                                                <telerik:GridTemplateColumn HeaderText="Title" SortExpression="ProductName" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
                                                    <ItemTemplate>
                                                        <div style="font-size: 12px; margin-top: 5px;">
                                                            <asp:LinkButton ID="lblProductName" runat="server" Text='<%# ValueOrDefault(Eval("ProductName"), "").ToString()%>' CommandName="ShowDetails" CommandArgument='<%# CDbl(ValueOrDefault(Eval("ProductID"), 0))%>' />
                                                        </div>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>

                                                <telerik:GridTemplateColumn HeaderText="Date" SortExpression="CreatedDate" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
                                                    <ItemStyle Width="120px" />
                                                    <ItemTemplate>
                                                        <div style="font-size: 12px; margin-top: 5px;">
                                                            <asp:Label ID="lbDate" runat="server" Text='<%# FormatDateTime(CDate(ValueOrDefault(Eval("CreatedDate"), Nothing)).ToShortDateString).ToString()%>' />
                                                        </div>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>

                                                <telerik:GridTemplateColumn HeaderText="" SortExpression="">
                                                    <ItemStyle Width="80px" />
                                                    <ItemTemplate>
                                                        <asp:ImageButton runat="server" ID="ibDelete" OnClientClick="return confirm('Are you sure you want to remove this project?');" ImageUrl="~/admin/img/bin.png" Style="width: 20px; height: auto;" CommandName="Delete" CommandArgument='<%# ValueOrDefault(Eval("CategoryID"), "0")%>' />
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>

                                            </Columns>
                                        </MasterTableView>
                                        <%--<ClientSettings>
                                            <Selecting AllowRowSelect="true" />
                                            <ClientEvents OnRowDblClick="SearchGridRowDoubleClick" />
                                        </ClientSettings>--%>
                                    </telerik:RadGrid>

                                    <asp:ObjectDataSource ID="odsProducts" runat="server" EnablePaging="true" TypeName="UI.BL.Products"
                                        SelectMethod="GetProducts" SelectCountMethod="ProductsCount" SortParameterName="SortBy">
                                        <SelectParameters>
                                            <asp:Parameter Name="searchFor" DefaultValue="" Type="String" />
                                            <asp:Parameter Name="criteria" DefaultValue="" Type="String" />
                                        </SelectParameters>
                                    </asp:ObjectDataSource>


                                    <div class="form-actions" style="padding-top: 30px;">
                                        <%--<button type="submit" class="btn btn-primary">Save</button>
                                        <button class="btn">Cancel</button>
                                        <button class="btn btn-info">Info</button>
                                        <button class="btn btn-danger">Danger</button>
                                        <button class="btn btn-warning">Warning</button>
                                        <button class="btn btn-invert">Invert</button>
                                        <button class="btn btn-success">Success</button>--%>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /widget-content -->
            </div>
            <!-- /widget -->
        </div>
        <!-- /span8 -->
    </div>


     <telerik:RadAjaxLoadingPanel runat="server" ID="ralpRefresh"></telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxManagerProxy ID="rampAmentities" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="dlstPictures">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="dlstPictures" LoadingPanelID="ralpRefresh" />
                    <telerik:AjaxUpdatedControl ControlID="hfFileIds"/>
                    
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>

</asp:Content>
